package com.itheima.d03_io_char_case;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class Test {

    public static void main(String[] args) throws IOException {

        try (

            FileReader fr = new FileReader("day11_io\\src\\com\\itheima\\d03_io_char_case\\kun.txt");
            FileWriter fw = new FileWriter("day11_io\\src\\com\\itheima\\d03_io_char_case\\aikun.txt");
                ){


            int b;
            while((b = fr.read()) != -1){
                fw.write( (char)b +"♥");
            }

            //注意：使用字符输出流写数据时，必须刷新缓冲区，将数据写出去
            //字符输出流：自带缓冲区，写数据时，数据会先写入缓冲区，缓冲区满了，才会将数据写入文件（减少IO次数）
            //fw.flush();
            //fw.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
